﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Serialization;
using System.Runtime.Serialization;


namespace D20Helper.D20Attribute
{
    /// <summary>
    /// Used for attributes like Strength, Intelliegnce, etc
    /// </summary>
    [DataContract]
    public class CharacterAttribute
    {
        [DataMember]
        private String name = String.Empty;
        public String Name
        {
            get { return name; }
            set { name = value; }
        }

        [DataMember]
        UInt16 value = 0;
        public UInt16 Value
        {
            get { return this.value; }
            set
            {
                this.value = value;
                ValueChanged(this, new EventArgs());
            }
        }

        public UInt16 GetModifier()
        {
            return (UInt16)((Value - 10) / 2);
        }

        public event EventHandler ValueChanged = delegate{};
    }
}
